using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace SyncUdp.CommonDefined
{
    [CreateAssetMenu(menuName = "SO/CommonDataSO", fileName = "CommonDataSO")]
    public class CommonDataSO : ScriptableObject
    {
        [Tooltip("服务器帧率，即频率")]
        public float serverFPS;

        [Tooltip("服务器分发输入的时间（秒）")]
        public float serverDispatchesTime;
        
        [Tooltip("服务器检测断连的时间（秒）")]
        public float serverCheckDisconnectionTime;

        [Tooltip("客户端发送心跳数据报的间隔（秒，包括重连）")]
        public float clientCheckDisconnectionTime;

        [Tooltip("客户端发送心跳数据报的次数（包括重新连接次数）")]
        public int clientReconnectionCount;

        [Range(0f, 1f), Tooltip("客户端等待发送心跳数据报的时间的比例")]
        public float clientWaitingNotDisconnectionTimeMultiplier;
        
        [Range(0f, 1f), Tooltip("客户端预测误差")]
        public float clientPredictionDifference;

        [Tooltip("通信时，浮点数保留几位小数所用的乘数；如保留两位，则乘以 100")]
        public float unitsMultiplier;

        private void OnValidate()
        {
            serverDispatchesTime = 1f / serverFPS;
        }
    }
}
